/*
 * Generated via the com.flca generator
 */
define([
	"dojo", 
	"dojo/dom", 
	"dojo/on", 
	"dojo/topic", 
	"dojo/_base/xhr", 
	"flca/voicenav/srv/VoiceNavServicesImpl",
	"flca/voicenav/VoiceNavConstants"], 
function(
	dojo, 
	dom, 
	on, 
	topic, 
	xhr, 
	VoiceNavServicesImpl,
	C) 
{
 
	// var's to define url's for all corresponding methods in the class that contains the rest interface 
	var baseurl = C.MOCK_SERVICES ? "./resources/" : C.REST_BASE_URL + "/rest/",
		urlext = C.MOCK_SERVICES ? ".json" : "";
	
	var getUrl = function(aServiceName) {
		return baseurl + aServiceName + urlext;	
	};
	
	var VoiceNavServices = 
	{ 
		optimizeRoute : function(aRoute) { // List<PNode> aRoute
			console.log("start optimizeRoute "); // + dojo.toJson(aRoute)  );
			xhr.get({
				url : getUrl('optimizeRoute'),
				handleAs : "json",
                content: {
					aRoute : dojo.toJson(aRoute)  
                },
				load : function(data) {
					console.log("finish optimizeRoute "); // + dojo.toJson(data));
					VoiceNavServicesImpl.optimizeRoute(data);
				},
				error : function(error) {
					console.log("*** error in optimizeRoute " + error);
				}
			})
		},
	
		
		_last : function() {}
	}
	
	return VoiceNavServices;
})
